// // models/jwtBlacklistModel.js
// const pool = require('../config/db');

// const addTokenToBlacklist = async (token) => {
//   const [result] = await pool.query('INSERT INTO jwt_blacklist (token) VALUES (?)', [token]);
//   return result.insertId;
// };

// const isTokenBlacklisted = async (token) => {
//   const [rows] = await pool.query('SELECT * FROM jwt_blacklist WHERE token = ?', [token]);
//   return rows.length > 0;
// };

// module.exports = {
//   addTokenToBlacklist,
//   isTokenBlacklisted,
// };
const pool = require('../config/db');

const addTokenToBlacklist = async (token) => {
  const [result] = await pool.query('INSERT INTO jwt_blacklist (token) VALUES (?)', [token]);
  return result.insertId;
};

const isTokenBlacklisted = async (token) => {
  const [rows] = await pool.query('SELECT * FROM jwt_blacklist WHERE token = ?', [token]);
  return rows.length > 0;
};

module.exports = {
  addTokenToBlacklist,
  isTokenBlacklisted,
};
